home *** CD-ROM | disk | FTP | other *** search
- on doButtonStuff ButtonAction, downSound, upSound
- set ButtonSprite to the clickOn
- set DoButtonTask to 0
- set ButtonUpCast to the castNum of sprite ButtonSprite
- set ButtonDownCast to ButtonUpCast + 50
- set initialClickDown to 1
- repeat while the stillDown
- if rollOver(ButtonSprite) then
- if initialClickDown = 1 then
- if not downSound = 0 then
- puppetSound(downSound)
- end if
- set initialClickDown to 0
- else
- nothing()
- end if
- set the castNum of sprite ButtonSprite to ButtonDownCast
- updateStage()
- set DoButtonTask to 1
- next repeat
- end if
- set the castNum of sprite ButtonSprite to ButtonUpCast
- updateStage()
- set DoButtonTask to 0
- if initialClickDown = 0 then
- repeat while soundBusy(1)
- nothing()
- end repeat
- if not upSound = 0 then
- puppetSound(upSound)
- end if
- set initialClickDown to 1
- end if
- end repeat
- if the castNum of sprite ButtonSprite = ButtonDownCast then
- set the castNum of sprite ButtonSprite to ButtonUpCast
- repeat while soundBusy(1)
- nothing()
- end repeat
- if not upSound = 0 then
- puppetSound(upSound)
- end if
- updateStage()
- end if
- if DoButtonTask = 1 then
- do(ButtonAction)
- end if
- puppetSound(0)
- end
-